/*
 * @Author: FamiliennameistChow nameistchow@hotmail.com
 * @Date: 2023-10-31 23:43:35
 * @LastEditors: FamiliennameistChow nameistchow@hotmail.com
 * @LastEditTime: 2023-11-01 00:01:26
 * @FilePath: /pcl_tutorials/PCLShow.hpp
 * @Description: 
 * 
 * Copyright (c) 2023 by FamiliennameistChow, All Rights Reserved. 
 */
#ifndef _PCL_SHOW_H_
#define _PCL_SHOW_H_
#include <iostream>
#include "PointCloudView.hpp"

class PCLShow
{
private:
    boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;
public:
    PCLShow(/* args */){
        viewer = boost::make_shared<pcl::visualization::PCLVisualizer>("PCL Viewer");
        viewer->setBackgroundColor(0, 0, 0);
        viewer->addCoordinateSystem(1.0);
        viewer->initCameraParameters();
        viewer->setCameraPosition(0, 0, -1, 0, -1, 0);
        viewer->setCameraClipDistances(0.01, 10.01);
        viewer->setSize(1280, 1024);
        viewer->registerKeyboardCallback(keyboardEventOccurred, (void*)&viewer);
        viewer->registerPointPickingCallback(pointPickingEventOccurred, (void*)&viewer);
        viewer->registerMouseCallback(mouseEventOccurred, (void*)&viewer);
        viewer->registerKeyboardCallback(keyboardEventOccurred, (void*)&viewer);

    };
    ~PCLShow(){};

    void addCloudPtr(pcl::PointCloud<PointTpye>::Ptr cloud_ptr,  std::string cloud_name){

        viewer->addPointCloud(cloud_ptr, cloud_name);
        viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, cloud_name);

        pcl::visualization::PointCloudColorHandlerCustom<PointType> single_color(cloud, 255, 255, 255);
        viewer->addPointCloud<PointType>(cloud, single_color, "cloud");
        viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "cloud");
    }
};



#endif